# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=postgresql-common
pkgver=1.2
pkgrel=1
pkgdesc="Common files for PostgreSQL"
url="https://www.postgresql.org/"
arch="noarch"
license="MIT"
install="$pkgname.pre-install $pkgname.pre-deinstall"
triggers="$pkgname.trigger=/usr/libexec/postgresql*:/usr/share/postgresql*"
subpackages="$pkgname-openrc"
source="pg_versions
	postgresql.initd
	postgresql.confd
	"
builddir="$srcdir"
options="!check"  # no tests

# secfixes:
#   0:
#     - CVE-2019-3466

package() {
	mkdir -p "$pkgdir"

	install -D -m755 "$srcdir"/pg_versions "$pkgdir"/usr/sbin/pg_versions
}

openrc() {
	pkgdesc="OpenRC init scripts for PostgreSQL"
	depends=""
	replaces="postgresql-openrc"  # for backward compatibility
	# Do not set install_if here.

	install -D -m755 "$srcdir"/postgresql.initd "$subpkgdir"/etc/init.d/postgresql
	install -D -m644 "$srcdir"/postgresql.confd "$subpkgdir"/etc/conf.d/postgresql
}

sha512sums="
3da6244dc23d89fd337ff76cdf619d9a13ef0545cb169b8592ad871e3e79719667e685d42acbd0aacee4c2aa556753530642cb24cc1322a2068f639d0b874b2b  pg_versions
6db1ae70b0a2ac1e5985139f56a0f2e3e0e93e0604a79807e73052097718141c16865473cd372a03e02565360ef92b28ef53b7a8d477841be65e541a8821b66b  postgresql.initd
b82351afd7eb89530b1b86aa6d362e8710035a3623c4b8125723038103634274312fc88dd8a18b2e387cca9e9ae4158b76479b59bc7ff6ba0b15a7a806e21cd5  postgresql.confd
"
